<?php
class ControllerExtensionModuleBlogCategory extends Controller {
	public function index() {
		if (!$this->config->get('blog_status')) {
			return;
		}

		$this->load->language('extension/module/blog_category');
		$data['heading_title'] = $this->language->get('heading_title');

		$this->load->model('blog/blog');

		$data['categories'] = array();
		$categories = $this->model_blog_blog->getAllCategories();
		foreach ($categories as $category) {
			$data['categories'][] = array(
				'name'       => $category['name'],
				'href'       => $this->url->link('blog/category', "blog_category_id={$category['category_id']}")
			);
		}

		if ($data['categories']) {
			return $this->load->view('extension/module/blog_category', $data);
		}
	}
}
